@using BlazorApp.Pages.Common.Html.HTable
@using BlazorApp.Pages.Common.Metadata
@using BlazorApp.Pages.Event
@using k8s.Models
@inherits BlazorApp.Pages.Common.DrawerPageBase<k8s.Models.V1LimitRange>
@if (LimitRange != null)
{
    <LimitRangeAction Item="LimitRange" MenuMode="MenuMode.Horizontal"></LimitRangeAction>
    <Divider Orientation="left" Style="font-weight:bold">@L["Metadata"]</Divider>
    <MetadataView Item="LimitRange.Metadata" ExplainFieldPrefix="limitRange"></MetadataView>
    <Divider Orientation="left" Style="font-weight:bold">@L["Spec"]</Divider>
    <HTable Bordered Column="1">
        @if (LimitRange.Spec.Limits is { Count: > 0 })
        {
            @foreach (var limit in LimitRange.Spec.Limits)
            {
                <PropertySimpleView Item="limit.Type" Title=@L["Type"]
                                    ExplainField="limitRange.spec.limits.type">
                </PropertySimpleView>
                <PropertyMapView Items="limit.DefaultProperty" Title=@L["Default"] T="ResourceQuantity"
                                 ExplainField="limitRange.spec.limits.default">
                </PropertyMapView>
                <PropertyMapView Items="limit.DefaultRequest" Title=@L["DefaultRequest"] T="ResourceQuantity"
                                 ExplainField="limitRange.spec.limits.defaultRequest">
                </PropertyMapView>
                <PropertyMapView Items="limit.Max" Title=@L["Max"] T="ResourceQuantity"
                                 ExplainField="limitRange.spec.limits.max">
                </PropertyMapView>
                <PropertyMapView Items="limit.MaxLimitRequestRatio" Title=@L["MaxLimitRequestRatio"] T="ResourceQuantity"
                                 ExplainField="limitRange.spec.limits.maxLimitRequestRatio">
                </PropertyMapView>
                <PropertyMapView Items="limit.Min" Title=@L["Min"] T="ResourceQuantity"
                                 ExplainField="limitRange.spec.limits.min">
                </PropertyMapView>
            }
        }

    </HTable>
    <MiniEventListView Uid="@LimitRange.Metadata.Uid"></MiniEventListView>
}
